<?php
namespace app\food\model;

use think\Model;
use think\Db;

class FoodModel extends Model
{
    public function addFood($food)
    {
        $res = Db::name('food')->insert($food);
        return $res;
    }

    public function delFood($id)
    {
        $res = Db::name('food')->where('food_id', 'in', $id)->delete();
        return $res;
    }

    public function upFood($food)
    {
        $res = Db::name('food')->where('food_id', $food['food_id'])->update($food);
        return $res;
    }

    public function getFood($food)
    {
        $res = Db::name('food')->where($food)->order('food_ctime desc')->select();
        return $res;
    }
}
